package crack;

import common.TreeNode;

/**
 * @author fance
 * @date 18-4-8 下午4:13
 */
class Wrap {
   public static int val = Integer.MIN_VALUE;
}

public class TreeAndGraph {
    public boolean checkBST(TreeNode node) {
        if (node == null) {
            return true;
        }
        if (!checkBST(node.left)) {
            return false;
        }
        if (node.val <= Wrap.val) {
            return false;
        }
        Wrap.val = node.val;
        if (!checkBST(node.right)) {
            return false;
        }

        return true;
    }
}
